#ifdef TARG_SW5
#cc = sw5cc.old -host -O3 
#cc_slave = sw5cc.old  -O3 #-OPT:liberal_ivdep=TRUE
#else
cc = sw5cc -host -O3 
cc_slave = sw5cc -slave -O3 #-OPT:liberal_ivdep=TRUE
#endif

#ifdef TARG_SW3
#cc = swcc -O3 #-OPT: unroll_times_max=1 #-msimd 
#cc_slave = sw3cc -O3 #-OPT: unroll_times_max=1# -msimd
#endif

SCHEDULER_INSTALL_PATH=$(DAG_HOME)/dag_task_scheduler

#NAIIVE  = -D_NAIIVE_LAM
#MAIN = -D_MAIN_MEM
#EXTRA_FLAGS = -DSIZEX=3602 -DSIZEY=3602 -DBLKX=60 -DBLKY=60 -D_PROFILING -DCHECK -msimd #-D_DMA GET
#EXTRA_FLAGS = -DSIZEX=362 -DSIZEY=362 -DBLKX=40 -DBLKY=40 -msimd -D_PROFILING #-D_LDMM  -DCHECK -D_LOOPEXP #-D_UNROLL# -DCHECK #-D_DMA_GET
EXTRA_FLAGS = -DSIZEX=1802 -DSIZEY=1802 -DBLKX=60 -DBLKY=60 -msimd -D_PROFILING -D_UNROLL# -DCHECK #-D_DMA_GET

#OTHER_FLAGS = -D_LDMM -D_UNROLL 
CFLAGS = $(EXTRA_FLAGS)  -I${SCHEDULER_INSTALL_PATH}/include -L${SCHEDULER_INSTALL_PATH}/lib
LIBFLAGS =  -ldag_task_scheduler -lstdc++ -lm 

DIV_9_OBJECT = 2d5p_master.o 2d5p_div_9.o
REUSE9_OBJECT = 2d5p_master.o 2d5p_reuse_9_auto.o
REUSE9_A_OBJECT = 2d5p_master.o 2d5p_reuse_9_auto.o

unreuse:2d5p_master.o 2d5p_div_9.o 2d5p_unreuse
reuse_9:2d5p_master.o 2d5p_reuse_9_auto.o 2d5p_reuse_9
reuse_9_a:2d5p_master.o 2d5p_reuse_9_auto.o 2d5p_reuse_9_a

2d5p_master.o: 2d5p_master.c
	$(cc) $(CFLAGS) -c  2d5p_master.c  $(LIBFLAGS)
2d5p_div_9.o:  2d5p_div_9.c
	$(cc_slave) $(CFLAGS) $(NAIIVE) -c 2d5p_div_9.c  $(LIBFLAGS)
2d5p_reuse_9_auto.o:2d5p_reuse_9_auto.c
	$(cc_slave) $(CFLAGS)  -c 2d5p_reuse_9_auto.c  $(LIBFLAGS) 

2d5p_unreuse:  $(DIV_9_OBJECT) 
	$(cc_slave) -hybrid   $(CFLAGS)  -o 2d5p_unreuse $(DIV_9_OBJECT) $(LIBFLAGS) 
2d5p_reuse_9:  $(REUSE9_OBJECT)
	$(cc_slave) -hybrid   $(CFLAGS)  -o 2d5p_reuse_9 $(REUSE9_OBJECT) $(LIBFLAGS)
2d5p_reuse_9_a:  $(REUSE9_A_OBJECT)
	$(cc_slave) -hybrid   $(CFLAGS)  -o 2d5p_reuse_9_a $(REUSE9_A_OBJECT) $(LIBFLAGS) 
clean:
	@-rm -f *.o 2d5p_unreuse 2d5p_reuse_9_a 2d5p_reuse_9
